﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SingletonUnit
{
    /// <summary>
    /// .NET 4's Lazy<T> type 简单和性能良好，而且还提供检查是否已经创建实例的属性IsValueCreated
    /// </summary>
    public sealed class DotNetLazySingleton : BaseSingleton
    {
        private static readonly Lazy<DotNetLazySingleton> lazy = new Lazy<DotNetLazySingleton>(() => new DotNetLazySingleton());
        private DotNetLazySingleton() { }
        public static DotNetLazySingleton Instance { get { return lazy.Value; } }
    }
}
